package com.rm.zeyou.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.rm.zeyou.entity.Technician;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.service.TechnicianBackService;
import com.rm.zeyou.util.login.TechnicianLoginUtil;
import com.rm.zeyou.vo.request.AddTechnicianBackVo;
import com.rm.zeyou.vo.response.SelectTechnicianBackResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 技师银行卡 前端控制器
 * </p>
 *
 * @author YanYang
 * @since 2025-03-12 15:55:09
 */
@Api(tags = "技师银行卡相关")
@RestController
@RequestMapping("/api/technicianBack")
public class TechnicianBackController {
    @Resource
    private TechnicianBackService technicianBackService;
    @Resource
    private TechnicianLoginUtil technicianLoginUtil;

    @ApiOperation("添加技师银行卡")
    @PostMapping("addTechnicianBack")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<Integer> addTechnicianBack(@RequestBody AddTechnicianBackVo addVo) {
        Technician technician = technicianLoginUtil.getTechnician();
        return technicianBackService.addTechnicianBack(technician.getId(), addVo);
    }

    @ApiOperation("查询技师银行卡列表")
    @GetMapping("selectTechnicianBackList")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<SelectTechnicianBackResponseVo> selectTechnicianBackList() {
        Technician technician = technicianLoginUtil.getTechnician();
        return technicianBackService.selectTechnicianBackList(technician.getId());
    }
}
